package com.xxxx.yeb.controller;


import com.xxxx.yeb.pojo.Department;
import com.xxxx.yeb.pojo.RespBean;
import com.xxxx.yeb.service.impl.DepartmentServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 * @since 2020-07-17
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {
    @Autowired
    private DepartmentServiceImpl departmentService;

    @ApiOperation(value = "根据id查询部门")
    @GetMapping("/")
    public List<Department> getDePartmentByid(){

        return departmentService.getDePartmentByid();
    }
    @ApiOperation(value = "添加部门")
    @PostMapping("/")
    public RespBean addDepartment(@RequestBody Department dep){

        return departmentService.addDepartment( dep) ;
    }

    @ApiOperation(value = "删除部门")
    @DeleteMapping("/")
    public RespBean deleteDepartment( Integer id){

        return departmentService.deleteDepartment(id);
    }

}
